/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react'
// import {StatusBar} from 'react-native'
import {StackNavigator, TabNavigator, TabBarBottom } from 'react-navigation'
import {
	Platform,
	StyleSheet,
	BackAndroid,
	ToastAndroid,
	Text,
	View
} from 'react-native'
import axios from 'axios'
import TabBarItem from './src/common/TabBarItem'

import Home from './src/view/Home/Home'
import Ticketing from './src/view/Ticketing/Ticketing'
// import Ticketing from './src/view/Login'
import Inspect from './src/view/Login'
// import Inspect from './src/view/Inspect/Inspect'

let lastBackPressed = Date.now();
export default class App extends Component {
	constructor() {
		super()
	}

	componentDidMount() {
		BackAndroid.addEventListener('hardwareBackPress', function () {
			if (lastBackPressed && lastBackPressed + 1000 >= Date.now()) {
				BackAndroid.exitApp();
				//最近2秒内按过back键，可以退出应用。
				return false;
			}
			// ToastAndroid.show('再按一次退出应用')
			lastBackPressed = Date.now();
			return true;
		});
	}


	render() {
		return (
			<View></View>
			// <Tab />
		)
	}
}

const Tab = TabNavigator(
	{
	// 	Home: {
	// 		screen: Home,
	// 		navigationOptions: ({ navigation }) => ({
	// 			tabBarLabel: '售票',
	// 			tabBarIcon: ({ focused, tintColor }) => (
	// 				<TabBarItem
	// 					tintColor={tintColor}
	// 					focused={focused}
	// 					normalImage={require('./src/img/common/home.png')}
	// 					selectedImage={require('./src/img/common/home_selected.png')}
	// 				/>
	// 			)
	// 		}),
	// 	},
	// 	Inspect: {
	// 		screen: Inspect,
	// 		navigationOptions: ({ navigation }) => ({
	// 			tabBarLabel: '验票',
	// 			tabBarIcon: ({ focused, tintColor }) => (
	// 				<TabBarItem
	// 					tintColor={tintColor}
	// 					focused={focused}
	// 					normalImage={require('./src/img/common/travel.png')}
	// 					selectedImage={require('./src/img/common/travel_selected.png')}
	// 				/>
	// 			)
	// 		}),
	// 	},

	// 	Ticketing: {
	// 		screen: Ticketing,
	// 		navigationOptions: ({ navigation }) => ({
	// 			tabBarLabel: '票务记录',
	// 			tabBarIcon: ({ focused, tintColor }) => (
	// 				<TabBarItem
	// 					tintColor={tintColor}
	// 					focused={focused}
	// 					normalImage={require('./src/img/common/customer.png')}
	// 					selectedImage={require('./src/img/common/customer_selected.png')}
	// 				/>
	// 			)
	// 		}),
	// 	},
	// },
	// {
		// tabBarComponent: TabBarBottom,
		// tabBarPosition: 'bottom',
		// lazy: false,
		// animationEnabled: false,
		// swipeEnabled: false,
		// tabBarOptions: {
		// 	activeTintColor: '#105eae',
		// 	inactiveTintColor: '#979797',
		// 	style: {
		// 		backgroundColor: '#ffffff',
		// 		height: 50
		// 	},
		// 	labelStyle: {
		// 		fontSize: 11,
		// 		// marginBottom: 4
		// 	}
		// },
	}

)

